import { createStore } from 'vuex'



export default createStore({
  state: {
    count:1
  },
  mutations: { //修改state的方法
    changeCount(state,flag){
      state.count+=flag;
    }
  },
  actions: {
    countAction({commit},flag){
      // actions触发mutations
      commit('changeCount',flag)
    }
  },
  getters:{
    douCount:state=>state.count*2
  },
  modules: {
  }
})
